/*
package com.project.Filters;


import com.Entity.DzmHisMemberEntity;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;
import javax.servlet.*;
import javax.servlet.annotation.WebFilter;
import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.List;

@WebFilter("/*")
@Component
public class LogFilter implements Filter {

    @Resource
    private RedisTemplate<String, DzmHisMemberEntity> redisTemplate;


    public void doFilter(ServletRequest request1, ServletResponse response1, FilterChain chain)
            throws IOException, ServletException {
        HttpServletRequest request = (HttpServletRequest) request1;
        HttpServletResponse response = (HttpServletResponse) response1;
        String method = request.getMethod();
        if(method.toUpperCase().equals("OPTIONS")){chain.doFilter(request,response);return;}
        String url=request.getRequestURI();
        Cookie[] cookies = request.getCookies();
        String urls= request.getServletPath();
        response.setHeader("Access-Control-Allow-Origin", "http://127.0.0.1:8020");
        response.setHeader("Access-Control-Allow-Methods", "http://127.0.0.1:8020");
        response.setHeader("Access-Control-Max-Age", "3600");
        response.setHeader("Access-Control-Allow-Headers", "http://127.0.0.1:8020");
        response.setHeader("Access-Control-Allow-Credentials", "true");
        response.setContentType("application/json;charset=utf-8");
        response.setCharacterEncoding("UTF-8");
        String tok=null;
        if (cookies!=null) {
            for (Cookie cookie : cookies) {
                if (cookie.getName().equals("token")) {
                    tok=cookie.getValue();
                    break;
                }
            }
            DzmHisMemberEntity user = redisTemplate.opsForValue().get(tok);
            if (user==null) {
                String jsonStr = "{\"flag\":\"no\"}";
                PrintWriter out = null;
                out = response.getWriter();
                out.write(jsonStr);
                out.close();
            }else{
                chain.doFilter(request, response);
            }
        }else{
            String jsonStr = "{\"flag\":\"no\"}";
            PrintWriter out = null;
            out = response.getWriter();
            out.write(jsonStr);
            out.close();
        }
    }
}
*/
